import request from '@/utils/request'
import {pramsToQuery} from '@/utils/index'

// 添加部门
export function addOrganization(data) {
  return request({
    url: '/sys/organization/department',
    method: 'post',
    data
  })
}
// 编辑部门
export function putOrganization(data) {
  return request({
    url: `/sys/organization/department/${data.id}`,
    method: 'put',
    data
  })
}
// 获取组织架构列表
export function getOrgList(data) {
  return request({
    url: `/sys/organization/department?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 获取部门成员列表
export function getMemberList(data) {
  return request({
    url: `/sys/organization/members?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 编辑部门成员
export function editOrgMember(data) {
  return request({
    url: `/sys/organization/members/${data.id}`,
    method: 'put',
    data
  })
}
// 添加部门成员
export function addOrgMember(data) {
  return request({
    url: '/sys/organization/members',
    method: 'post',
    data
  })
}
// 删除部门成员
export function delOrgMember(data) {
  return request({
    url: '/sys/organization/members',
    method: 'delete',
    data
  })
}
// 部门调整
export function changeOrganization(data) {
  return request({
    url: '/sys/organization/members',
    method: 'put',
    data
  })
}
// 通讯录导入
export function importMailList(data) {
  return request({
    url: '/sys/organization/members/list',
    method: 'post',
    data
  })
}
// 获取部门-简单列表
export function getSimOrg(data) {
  return request({
    url: `/sys/organization/simple?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}// 获取部门-简单列表
export function getSimOrgActSimpleList(data) {
  return request({
    url: `/sys/organization/simpleList?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 获取部门成员-简单列表
export function getSimMember(data) {
  return request({
    url: `/sys/organization/members/simple?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}

  export function checkCode(data) {
    return request({
      url: `/sys/sms/verify?${pramsToQuery(data)}`,
      method: 'get',
      data
    })
}
